1. Field of the Invention
The present invention relates to an MPEG video decoding method and an MPEG video decoder.
2. Description of the Related Art
In recent years, strenuous effort has been made to provide methods for reproducing moving pictures in a mobile device, such as a mobile phone or a personal digital assistant (PDA). Since mobile devices are required to have low power consumption, they inevitably have limitations in terms of bandwidth and storage capacity, developing the need for a moving picture decoder that can operate at higher speeds and utilize memory more efficiently.
Even though various moving picture compression standards have already been suggested, H.263 and MPEG-4 simple profiles are considered the best choices for mobile wireless communications. MPEG-4 provides tolerance to channel errors, includes various functionality applicable to limited bandwidth and defines a streaming video profile. MPEG-4 has a high data compression rate. In order to support a high data compression rate, a considerable amount of encoder and decoder calculations are required. In short, the complicated structure of MPEG-4 makes it difficult to realize software that can perform real-time operations appropriate for MPEG-4.
FIG. 1 is a diagram illustrating the data hierarchy of MPEG video. The hierarchy is comprised of six levels: a sequence layer, a group of pictures (GOP) layer, a picture layer 110, a slice layer 120, a macroblock layer 130, and a block layer 140. In FIG. 1, the picture layer 110 and the underlying layers 120, 130, and 140 are shown.
Referring to FIG. 1, the picture layer 110 is a picture image comprised of slices 111 having a predetermined length, and the slice layer 120 is a band of an arbitrary number of macroblocks. The macroblock layer 130 is comprised of macroblocks, each containing six 8×8 pixel blocks, i.e., four blocks of a brightness signal Y and two blocks of color difference signal (Cb and Cr). The block layer 140 is comprised of 8×8 pixel blocks and includes discrete cosine transform (DCT) coefficient information.
The macroblock layer 130 includes motion vector information. The motion vector information is a value obtained by encoding the difference between motion vectors of a current macroblock and a previous macroblock.
Hereinafter, an MPEG-4 encoding method will be briefly described before explanation of the structure and operation of an MPEG-4 video decoder.
An input video object plane (VOP) is divided into macroblocks. The VOP is the basic unit of data in an MPEG-4 encoding process. During this process, each 8×8 block of a macroblock is DCTed and quantized. Thereafter, quantized DCT coefficients and a quantization width are encoded by using a variable length encoding method. This entire process is called intra-frame encoding.
A separate encoding process begins by using a motion detection method, such as block-matching. This technique consists of comparing macroblocks in temporally adjacent VOPs. After identifying the predicted macroblock having the least difference with a target macroblock, the motion variation signal, or motion vector, is obtained. The VOP of the predicted macroblock is called the reference VOP. By performing motion compensation on the reference VOP, based on the motion vector, the predicted macroblock can be obtained. Thereafter, the motion variation is DCTed and the DCT coefficients are quantized. The quantized DCT coefficients, the motion vector, and a quantization width are encoded by using a variable length encoding method. This entire process is called inter-frame encoding.
A receiving party decodes compressed and encoded VOP data by using a variable length decoding method. The difference signal is restored by performing inverse quantization and inverse DCT on quantized DCT coefficients. Thereafter, a predicted macroblock is obtained based on a motion vector and is added to the differential signal, thus reproducing image data.
FIG. 2 is a block diagram of a conventional MPEG-4 video decoder. Referring to FIG. 2, a conventional MPEG-4 video decoder 200 includes a demultiplexer 210 for an MPEG-4 video bitstream input thereinto, a texture decoding unit 220 for performing texture decoding, a restructured VOP storing unit 230, and a motion compensation unit 240.
The texture decoding unit 220 includes a variable length decoder (VLD) 221, an inverse scanner 222, an inverse quantizer 223, and an inverse discrete cosine transformer 224. The motion compensation unit 240 includes a motion decoder 241, a VOP memory 242, and a motion compensator 243.
Hereinafter, a general inter-frame reproducing method will be described. Intra-frame reproduction is the same as the inter-frame reproduction except for the process of motion compensation.
Through syntax-parsing of the bitstream, the header is separated and image data is extracted. Then, the variable length decoder 221 creates DCT coefficients through Huffman decoding of the image data, and the inverse scanner 222 creates data having the same order as the image data through inverse scanning.
The inverse quantizer 223 inversely quantizes the inversely-scanned data, and the inverse discrete cosine transformer 224 creates a differential image by performing DCT. When creating the differential image, a VOP for the differential image is generated by repeatedly performing macroblock-wise decoding. Then the restructured differential image VOP is stored in the VOP memory 242. When the differential image VOP is completed through texture decoding, motion decoding is performed utilizing a motion vector.
The motion decoder 241 creates a predicted image by decoding a motion vector. The motion compensator 243 adds this predicted image to the differential image stored in the VOP memory 242 and creates a decoded image.
FIG. 3 is a flowchart of a decoding method 300 performed in the conventional MPEG-4 video decoder 200 shown in FIG. 2. Referring to FIG. 3, information on the current macroblock is obtained in step S301 by decoding the header of the current macroblock. A motion vector is obtained in step S302, and the decoded motion vector is stored in motion vector memory in step S303. Thereafter, DCT coefficients are decoded in step S304.
A differential image macroblock is created by inversely scanning the decoded DCT coefficients in step S305, inversely quantizing the inversely-scanned DCT coefficients in step S306, and inversely discrete-cosine-transforming the inversely quantized DCT coefficients in step S307. The differential image macroblock is recorded in a frame buffer in step S308.
Thereafter, in step S309, it is determined whether or not all macroblocks belonging to one frame have been decoded.
If it is determined that all the macroblocks belonging to one frame have not yet been decoded, then steps S301 through S308 are repeated until one frame is generated.
If it is determined that all the macroblocks belonging to one frame have been decoded, i.e., if one frame is completed, then motion compensation is performed in step S310. Motion compensation represents a process of creating a predicted image macroblock. Through reference to motion vector memory, the motion vector is obtained and applied to previous image data to produce the predicted image macroblock.
Thereafter, in step S311, the motion-compensated predicted image frame is added to a differential image stored in a frame buffer. When the frame of the motion-compensated predicted image is added to the frame of the differential image recorded in the frame buffer, a decoded image frame is created.
FIG. 4 is a diagram illustrating unit frames used to generate a decoded image, according to a conventional MPEG-4 video decoding method. Referring to FIG. 4, in the prior art, a decoded image VOP 430 is generated by adding a predicted image VOP 410 and a differential image VOP 420.
Specifically, macroblocks 1 through 16 of the predicted image constitute the predicted image VOP 410, and macroblocks 1′ through 16′ of the differential image constitute the differential image VOP 420. Thereafter, macroblocks 1″ through 16″ of the decoded image VOP 430 are generated by adding the macroblocks 1 through 16 of the predicted image VOP 410 to the macroblocks 1′ through 16′ of the differential image VOP 420. In other words, the macroblock 1′ of the decoded image VOP 430 is generated by adding the macroblock 1 of the predicted image VOP 410 and the macroblock 1′ of the differential image VOP 420. The macroblock 2″ of the decoded image VOP 430 is generated by adding the macroblock 2 of the predicted image VOP 410 and the macroblock 2′ of the differential image VOP 420. In the same manner, the rest of the macroblocks 3″ through 16″ of the decoded image VOP 430 are generated by adding the macroblocks 3 through 16 of the predicted image VOP 410 and their corresponding macroblocks 3′ through 16′ of the differential image VOP 420.
According to the preceding conventional decoding method, a decoded image is stored in the current frame memory and preserved until a next frame is decoded. The current frame memory is always filled with the most recent decoded images. Accordingly, even when an image currently being decoded is the same as the previous image, the current image unnecessarily undergoes the same procedures used to generate the previous image. This aspect of the conventional method crates inefficiency in the decoding process.
Furthermore, according to the conventional decoding method, inverse DCT is performed first, a complete differential image frame is stored in a frame buffer, and then motion compensation is performed. Therefore, even in a block with a motion vector of 0, it is necessary to create a predicted image based on a previous image and store macroblocks of the predicted image. Since having a motion vector of 0 indicates portions of the previous image and the predicted image are the same, it is a waste of memory space to store the predicted image separately from the previous image.
Moreover, according to the present invention, texture decoding and motion compensation are sequentially performed. Thus, a motion vector generated during a variable length decoding process is stored in memory until referenced for motion compensation. In which case motion vector memory must be sufficient to support the number of macroblocks in a VOP.
In the case of decoding high compression rate data, inverse DCT and motion compensation may not always be necessary. However, the performance advantages gained by omitting these routines are not applicable to the conventional MPEG-4 video decoder. In creating a decoded image, by adding a differential image and a predicted image, the conventional MPEG-4 video decoder is further constrained by memory demands.